
Core.Collection.prototype.add = function ( item ) {
    this[this.count()] = item;
}

Core.Collection.prototype.count = function() {

    var size = 0, key;

    for ( key in this ) {
        if ( this.hasOwnProperty( key ) ) {
            size++;
        }
    }
    return size;

};

Core.Collection.prototype.each = function ( func ) {

    var index;

    for ( index in this ) {
        if ( this.hasOwnProperty( index ) ) {
            this[index].temporaryFunction = func;
            this[index].temporaryFunction( index );
            this[index].temporaryFunction = null; // Delete the function.
        }
    }

}

Core.Collection.prototype.getIndex = function ( item ) {

    var match;

    this.each( function ( index ) {
       if ( this == item ) {
           match = index;
       }
    });

    return ( match ) ? match : false;

}
